﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace InterfaceTest
{
    interface IShape
    {
        void SetPosition(int x, int y);
        int CalculateSurface();
        void Test();
    }

    interface ITest
    {
        void Test();
    }

    class Rectangle : IShape, ITest
    {
        private int coordinateX;
        private int coordinateY;
        private int height;
        private int width;

        public Rectangle()
        {
            coordinateX = 0;
            coordinateY = 0;
            width = 0;
            height = 0;
        }

        public Rectangle(int coordinateX, int coordinateY, int width, int height)
        {
            this.coordinateX = coordinateX;
            this.coordinateY = coordinateY;
            this.width = width;
            this.height = height;
        }

        public void SetPosition(int x, int y)
        {
            coordinateX = x;
            coordinateY = y;
        }

        public int CalculateSurface()
        {
            return width * height;
        }

        void IShape.Test()
        {
            Console.WriteLine("IShape!");
        }

        void ITest.Test()
        {
            Console.WriteLine("ITest!");
        }
    }

    class Interfaces
    {
        static void Main(string[] args)
        {
            Rectangle shape = new Rectangle(0, 1, 3, 4);
            shape.SetPosition(0,3);
            IShape ishape = (IShape)shape;
            ishape.Test();
            ITest itest = (ITest)shape;
            itest.Test();
        }
    }
}
